const { ccclass, property } = cc._decorator;

@ccclass
export default class BubbleFace extends cc.Component {
    @property(cc.Sprite)
    face: cc.Sprite = null;

    @property(cc.SpriteAtlas)
    atlas: cc.SpriteAtlas = null;

    set(face: string, time: number) {
        this.face.spriteFrame = this.atlas.getSpriteFrame(face);
        this.node.scale = 0;
        cc.tween(this.node)
            .to(0.2, { scale: 1 }, { easing: "backOut" })
            .delay(time)
            .to(0.2, { opacity: 0 })
            .call(() => {
                this.node.destroy()
            })
            .start();
    }
}
